<?php $this->load->view("common/page_header");?>
<?php $this->load->view("common/top_banner");?>
<?php $this->load->view("common/header");?>
<div id="body_main">
	<?php $this->load->view('common/user_top');?>
	<div class="top_border">
		<div class="arrow_up" style="left:90px"></div>
	</div>
	<div id="body_content" class="user_info">
		<?php $this->load->view("common/user_info_table");?>
		
		<div class="margin_top15">
			<?php $this->load->view("common/user_info_navigator");?>
			<div class="user_info_content">
				<div class="head">
					<ul class="suborder">
						<li ><a href="<?php echo site_url("user/messages")?>">未读信息</a></li>
						<li><a href="<?php echo site_url("user/messages?type=system")?>">系统信息</a></li>
						<li><a href="<?php echo site_url("user/messages?type=private")?>">私人信息</a></li>
						<li class="action current"><a href="javascript:void(0)">+发送信息</a></li>
					</ul>
					<div class="arrow_up" style="left:690px;">						
						<em>◆</em>
						<span>◆</span>
					</div>
					<div class="clear"></div>
				</div>
				<form method="post" action="">
					<div class="form_row" style="position:relative;overflow:visible;">
						<label class="input_label"><span class="red">*&nbsp;</span>收信人：</label>
						<input id="msg_to" class="input_text" type="text" name="msg_to" value="<?php echo (!empty($to_user['nickname']) ? $to_user['nickname'] : '');?>" style="width:250px"/>
						<a id="show_friends_list" class="margin_left15" href="javascript:void(0)">+添加收信人</a>
						<?php if(!empty($friends)) {?>
						<ul id="friends_list">
							<li class="bold">我的好友列表</li>
							<?php foreach($friends as $friend) {?>
							<li><?php echo $friend['nickname'];?></li>
							<?php } ?>
						</ul>
						<?php }?>
					</div>
					<div class="form_row">
						<label class="input_label"><span class="red">*&nbsp;</span>主题：</label>
						<input class="input_text" type="text" name="subject"/>
					</div>
					<div class="form_row">
						<label class="input_label"><span class="red">*&nbsp;</span>内容：</label>
						<textarea class="input_textarea" name="content"></textarea>
					</div>
					<div class="form_action">
						<input type="submit" class="button" value="发送"/>
					</div>
				</form>
			</div>
			<div class="clear"></div>
		</div>
	</div>
	
	<script>
		$('#show_friends_list').click(function(event){
			$('#friends_list').toggle();
			event.stopPropagation();
		});
		$('#friends_list').find('li[class!="bold"]').click(function(){
			var $this = $(this);
			var name = $this.text();
			var current_name = $('#msg_to').val();
			if (current_name != '') {
				name = current_name + ';' + name;
			}
			$('#msg_to').val(name);
			$('#friends_list').hide();
		});
		$('#friends_list').find('li').click(function(event){
			event.stopPropagation();
		});
		$(document).click(function(){
			$('#friends_list').hide();
		});
	</script>	
		
	<?php $this->load->view("common/footer");?>		
		
<p class="center">Page rendered in {elapsed_time} seconds</p>
	</div>
	
<?php $this->load->view("common/page_footer");?>
